import request from '@/utils/request'

/**
 * 获取文章列表
 * @returns
 */
export const getArticleListAPI = (params) => {
  return request({
    url: '/articleList',
    method: 'GET',
    params
  })
}

/**
 * 新增文章
 * @param {*} data
 * @returns
 */
export const addArticleAPI = (data) => {
  return request({
    url: '/article',
    method: 'POST',
    data
  })
}

/**
 * 根据 id 查询文章
 * @param {*} id
 * @returns
 */
export const getArticleAPI = (id) => {
  return request({
    url: `/article/${id}`,
    method: 'GET'
  })
}

export const putArticleAPI = (id, data) => {
  return request({
    url: `/article/${id}`,
    method: 'PUT',
    data
  })
}
